<?php

namespace App\Controller\Api\User;

use App\Controller\Api\BaseController;
use App\Service\OrderService;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\RequestMapping;

/**
 * @Controller(prefix="/user/v1/callback")
 */
class CallbackController extends BaseController
{



    /**
     * @Inject()
     * @var OrderService
     */
    public $orderService;


    /**
     * @RequestMapping(path="orderConfirm")
     * @return void
     */
    public function orderConfirm(){
        $params = $this->request->post();


        $this->validate($params, [
            'orderNo' => 'required'
        ]);


        $result = $this->orderService->confirmOrder($params['orderNo']);

        switch ($result['code']){
            case 1:
                return $this->response->returnSuccess(['info'=>$result['orderGoods']]);
                //支付成功的
                break;
            case 2:
                //支付中
                break;
            case 0:
                //支付失败
                break;
            default:
                //支付异常处理
                break;
        }



    }

}